###########################################################################
##########
#Argentina
##########

### Dependent and Independent Variables

gen CCT=0
replace CCT=1 if cct1==1
replace CCT=. if missing(cct1)

gen BEHAVIOR07=0
replace BEHAVIOR07=1 if vb3!=1701 & vb3!=00
replace BEHAVIOR07=2 if vb2==2 | vb3==00
replace BEHAVIOR07=. if missing(vb2)
replace BEHAVIOR07=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1|vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen AGE=0
replace AGE=q2/10
replace AGE=. if missing(q2)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 1 (Appendix C)
mlogit BEHAVIORNOW CCT##BEHAVIOR07 FEMALE WHITE AGE COLLEGE URBAN RICH, base(0)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR07 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 1 (Appendix C)
margins, dydx(CCT) at(BEHAVIOR07=0) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR07=0) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR07=0) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR07=1) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR07=1) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR07=1) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR07=2) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR07=2) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR07=2) predict(outcome(2))

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(2))


###########################################################################
########
#Belize
########

### Dependent and Independent Variables

gen BEHAVIOR08=0
replace BEHAVIOR08=1 if vb3!=2601 & vb3!=00
replace BEHAVIOR08=2 if vb2==2 | vb3==0
replace BEHAVIOR08=. if missing(vb2)
replace BEHAVIOR08=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=q2/10

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>14
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (Appendix E)

mlogit BEHAVIORNOW c.INDEX##BEHAVIOR08 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 4 (Appendix E)

margins, dydx(INDEX) at(BEHAVIOR08=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR08=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR08=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR08=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR08=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR08=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR08=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR08=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR08=2) predict(outcome(2))


###########################################################################
########
#Bolivia
########

### Dependent and Independent Variables

gen CCT=0
replace CCT=1 if cct1==1
replace CCT=. if missing(cct1)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1|vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen BEHAVIOR09=0
replace BEHAVIOR09=1 if vb3!=1002&vb3!=00
replace BEHAVIOR09=2 if vb2==2|vb3==00
replace BEHAVIOR09=. if missing(vb2)
replace BEHAVIOR09=. if vb2==1&missing(vb3)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen AGE=0
replace AGE=q2/10
replace AGE=. if missing(q2)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 1 (Appendix C)
mlogit BEHAVIORNOW CCT##BEHAVIOR09 FEMALE WHITE AGE COLLEGE URBAN RICH [pweight=wt], base(0)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR09 FEMALE WHITE AGE URBAN [pweight=wt], base(0)


### AMEs

# Table 1 (Appendix C)
margins, dydx(CCT) at(BEHAVIOR09=0) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR09=0) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR09=0) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR09=1) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR09=1) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR09=1) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR09=2) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR09=2) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR09=2) predict(outcome(2))

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(2))


###########################################################################
#######
#Brazil
#######

### Dependent and Independent Variables

gen CCT=0
replace CCT=1 if cct1bra==1
replace CCT=. if missing(cct1bra)

gen ANTIBF=0
replace ANTIBF=1 if cct4bra==3|cct4bra==4
replace ANTIBF=. if missing(cct4bra)

gen BEHAVIOR06=0
replace BEHAVIOR06=1 if vb3!=1501&vb3!=00
replace BEHAVIOR06=2 if vb2==2|vb3==00
replace BEHAVIOR06=. if vb2==1&missing(vb3)
replace BEHAVIOR06=. if missing(vb2)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1|vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=0
replace AGE=q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>11
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 1 (Appendix C)
mlogit BEHAVIORNOW CCT##BEHAVIOR06 FEMALE WHITE AGE COLLEGE URBAN RICH [pweight=wt], base(0)

### Model Table 2 (Appendix D)
mlogit BEHAVIORNOW CCT##BEHAVIOR06 ANTIBF##BEHAVIOR06 FEMALE WHITE AGE COLLEGE URBAN RICH [pweight=wt], base(0)

### Models Table 3
logit ANTIBF RICH COLLEGE CONSERVATIVE SKEPTICAL [pweight=wt] 
logit ANTIBF RICH COLLEGE CONSERVATIVE SKEPTICAL FEMALE WHITE AGE URBAN [pweight=wt]
logit ANTIBF INDEX FEMALE WHITE AGE URBAN [pweight=wt]

### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR06 FEMALE WHITE AGE URBAN [pweight=wt], base(0)


### AMEs

# Table 1 (Appendix C)
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(2))

# Table 2 (Appendix D)
margins, dydx(ANTIBF) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(ANTIBF) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(ANTIBF) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(ANTIBF) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(ANTIBF) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(ANTIBF) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(ANTIBF) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(ANTIBF) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(ANTIBF) at(BEHAVIOR06=2) predict(outcome(2))

### Table 3
margins, dydx (RICH)
margins, dydx (COLLEGE)
margins, dydx (CONSERVATIVE)
margins, dydx (SKEPTICAL)
margins, dydx (LIBERAL)
margins, dydx (INDEX)
margins, dydx (INDEX2)
margins, dydx (INDEX3)
margins, at(RICH=0 COLLEGE=0 CONSERVATIVE=0)
margins, at(RICH=1 COLLEGE=1 CONSERVATIVE=1)
margins, at(RICH=0 COLLEGE=0 CONSERVATIVE=0 SKEPTICAL=0)
margins, at(RICH=1 COLLEGE=1 CONSERVATIVE=1 SKEPTICAL=1)
margins, at(RICH=0 COLLEGE=0 CONSERVATIVE=0 LIBERAL=0)
margins, at(RICH=1 COLLEGE=1 CONSERVATIVE=1 LIBERAL=1)
margins, at (INDEX=0)
margins, at (INDEX=4)
margins, at (INDEX2=0)
margins, at (INDEX2=3)
margins, at (INDEX3=0)
margins, at (INDEX3=4)

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(2))


###########################################################################
#########
#Colombia
#########

### Dependent and Independent Variables

gen CCT=0
replace CCT=1 if cct1==1
replace CCT=. if missing(cct1)

gen BEHAVIOR06=0
replace BEHAVIOR06=1 if vb3!=803 & vb3!=00
replace BEHAVIOR06=2 if vb2==2 | vb3==00
replace BEHAVIOR06=. if missing(vb2)
replace BEHAVIOR06=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if colvb20<6
replace BEHAVIORNOW=2 if colvb20==7
replace BEHAVIORNOW=. if missing(colvb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=0
replace AGE=q2/10
replace AGE=. missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>11
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 1 (Appendix C)
mlogit BEHAVIORNOW CCT##BEHAVIOR06 FEMALE WHITE AGE COLLEGE URBAN RICH, base(0)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR06 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 1 (Appendix C)
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(2))

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(2))


### Figure 1

predict opposition, outcome(0)
predict apathetic, outcome(1)
predict supporter, outcome(2)

twoway (mspline opposition INDEX) (mspline apathetic INDEX) (mspline supporter INDEX) if BEHAVIOR06==2, ytitle(Predicted Probability) xtitle(Index of Propensity to Oppose Income Redistribution) legend(cols(3) order(1 "Pr(Opposition)" 2 "Pr(Apathetic)" 3 "Pr(Supporter)"))


###########################################################################
###########
#Costa Rica
###########

### Dependent and Independent Variables

gen BEHAVIOR06=0
replace BEHAVIOR06=1 if vb3!=602 & vb3!=00
replace BEHAVIOR06=2 if vb2==2 | vb3==00
replace BEHAVIOR06=. if missing(vb2)
replace BEHAVIOR06=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=0
replace AGE=q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR06 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(2))


###########################################################################
###################
#Dominican Republic
###################

### Dependent and Independent Variables

gen CCT=0
replace CCT=1 if domts2a==1|domts2b==1|domts2c==1
replace CCT=. if missing(domts1)

gen BEHAVIOR08=0
replace BEHAVIOR08=1 if vb3!=2101 & vb3!=00
replace BEHAVIOR08=2 if vb2==2 | vb3==00
replace BEHAVIOR08=. if missing(vb2)
replace BEHAVIOR08=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=0
replace AGE=q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 1 (Appendix C)
mlogit BEHAVIORNOW CCT##BEHAVIOR08 FEMALE WHITE AGE COLLEGE URBAN RICH, base(0)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR08 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 1 (Appendix C)
margins, dydx(CCT) at(BEHAVIOR08=0) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR08=0) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR08=0) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR08=1) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR08=1) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR08=1) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR08=2) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR08=2) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR08=2) predict(outcome(2))

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR08=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR08=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR08=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR08=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR08=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR08=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR08=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR08=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR08=2) predict(outcome(2))


###########################################################################
########
#Ecuador
########

### Dependent and Independent Variables

gen CCT=0
replace CCT=1 if cct1==1
replace CCT=. if missing(cct1)

gen BEHAVIOR09=0
replace BEHAVIOR09=1 if vb3!=901 & vb3!=00
replace BEHAVIOR09=2 if vb2==2 | vb3==00
replace BEHAVIOR09=. if missing(vb2)
replace BEHAVIOR09=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=0
replace AGE= q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 1 (Appendix C)
mlogit BEHAVIORNOW CCT##BEHAVIOR09 FEMALE WHITE AGE COLLEGE URBAN RICH [pweight=wt], base(0)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR09 FEMALE WHITE AGE URBAN [pweight=wt], base(0)


### AMEs

# Table 1 (Appendix C)
margins, dydx(CCT) at(BEHAVIOR09=0) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR09=0) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR09=0) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR09=1) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR09=1) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR09=1) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR09=2) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR09=2) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR09=2) predict(outcome(2))

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(2))


###########################################################################
############
#El Salvador
############

### Dependent and Independent Variables

gen BEHAVIOR09=0
replace BEHAVIOR09=1 if vb3!=302 & vb3!=00
replace BEHAVIOR09=2 if vb2==2 | vb3==00
replace BEHAVIOR09=. if missing(vb2)
replace BEHAVIOR09=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1|vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=0
replace AGE=q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR09 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(2))


###########################################################################
##########
#Guatemala
##########

### Dependent and Independent Variables

gen CCT=0
replace CCT=1 if guan20==1
replace CCT=. if missing(guan20)

gen BEHAVIOR07=0
replace BEHAVIOR07=1 if vb3!=201 & vb3!=00
replace BEHAVIOR07=2 if vb2==2 | vb3==00
replace BEHAVIOR07=. if missing(vb2)
replace BEHAVIOR07=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen LADINO=0
replace LADINO=1 if etid==2
replace LADINO=. if missing(etid)

gen AGE=0
replace AGE=q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6 & CCT!=1
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 1 (Appendix C)
mlogit BEHAVIORNOW CCT##BEHAVIOR07 FEMALE LADINO AGE COLLEGE URBAN RICH, base(0)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR07 FEMALE LADINO AGE URBAN, base(0)


### AMEs

# Table 1 (Appendix C)
margins, dydx(CCT) at(BEHAVIOR07=0) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR07=0) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR07=0) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR07=1) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR07=1) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR07=1) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR07=2) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR07=2) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR07=2) predict(outcome(2))

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(2))


###########################################################################
#######
#Guyana
#######

### Dependent and Independent Variables

gen BEHAVIOR06=0
replace BEHAVIOR06=1 if vb3!=2401 & vb3!=0
replace BEHAVIOR06=2 if vb2==2 | vb3==0
replace BEHAVIOR06=. if missing(vb2)
replace BEHAVIOR06=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=q2/10

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>11
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(LIBERAL)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (no variation in WHITE) (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR06 FEMALE AGE URBAN, base(0)


### AMEs

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(2))


### Figure 1

predict opposition, outcome(0)
predict apathetic, outcome(1)
predict supporter, outcome(2)

twoway (mspline opposition INDEX) (mspline apathetic INDEX) (mspline supporter INDEX) if BEHAVIOR06==0, ytitle(Predicted Probability) xtitle(Index of Propensity to Oppose Income Redistribution) legend(cols(3) order(1 "Pr(Opposition)" 2 "Pr(Apathetic)" 3 "Pr(Supporter)"))


###########################################################################
#########
#Honduras
#########

### Dependent and Independent Variables

gen BEHAVIOR09=0
replace BEHAVIOR09=1 if vb3!=404 & vb3!=00
replace BEHAVIOR09=2 if vb2==2 | vb3==00
replace BEHAVIOR09=. if missing(vb2)
replace BEHAVIOR09=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1|vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=0
replace AGE=q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR09 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(2))


###########################################################################
########
#Jamaica
########

### Dependent and Independent Variables

gen BEHAVIOR07=0
replace BEHAVIOR07=1 if vb3!=2302 & vb3!=0
replace BEHAVIOR07=2 if vb2==2 | vb3==0
replace BEHAVIOR07=. if missing(vb2)
replace BEHAVIOR07=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>11
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (no variation in variable WHITE) (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR07 FEMALE AGE URBAN, base(0)


### AMEs

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(2))


###########################################################################
#######
#Mexico
#######

### Dependent and Independent Variables

gen CCT=0
replace CCT=1 if cct1==1
replace CCT=. if missing(cct1)

gen BEHAVIOR06=0
replace BEHAVIOR06=1 if vb3!=101 & vb3!=0
replace BEHAVIOR06=2 if vb2==2|vb3==0
replace BEHAVIOR06=. if missing(vb2)
replace BEHAVIOR06=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=0
replace AGE=q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 1 (Appendix C)
mlogit BEHAVIORNOW CCT##BEHAVIOR06 FEMALE WHITE AGE COLLEGE URBAN RICH, base(0)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR06 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 1 (Appendix C)
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(2))

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(2))


###########################################################################
##########
#Nicaragua
##########

### Dependent and Independent Variables

gen BEHAVIOR06=0
replace BEHAVIOR06=1 if vb3!=502 & vb3!=0
replace BEHAVIOR06=2 if vb2==2 | vb3==0
replace BEHAVIOR06=. if missing(vb2)
replace BEHAVIOR06=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=q2/10

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR06 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(2))


###########################################################################
#######
#Panama
#######

### Dependent and Independent Variables

gen BEHAVIOR09=0
replace BEHAVIOR09=1 if vb3!=702 & vb3!=00
replace BEHAVIOR09=2 if vb2==2 | vb3==00
replace BEHAVIOR09=. if missing(vb2)
replace BEHAVIOR09=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1|vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR09 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(2))


###########################################################################
#########
#Paraguay
#########

### Dependent and Independent Variables

gen BEHAVIOR08=0
replace BEHAVIOR08=1 if vb3!=1201 & vb3!=00
replace BEHAVIOR08=2 if vb2==2 | vb3==00
replace BEHAVIOR08=. if missing(vb2)
replace BEHAVIOR08=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1|vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=q2/10

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR08 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR08=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR08=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR08=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR08=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR08=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR08=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR08=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR08=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR08=2) predict(outcome(2))


###########################################################################
#########
#Suriname
#########

### Dependent and Independent Variables

gen BEHAVIOR05=0
replace BEHAVIOR05=1 if vb3!=2709 & vb3!=0
replace BEHAVIOR05=2 if vb2==2 | vb3==0
replace BEHAVIOR05=. if missing(vb2)
replace BEHAVIOR05=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=q2/10

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>14
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (no variatin in WHITE) (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR05 FEMALE AGE URBAN [pweight=wt], base(0)


### AMEs

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR05=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR05=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR05=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR05=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR05=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR05=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR05=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR05=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR05=2) predict(outcome(2))


###########################################################################
##################
#Trinidad & Tobago
##################

### Dependent and Independent Variables

gen BEHAVIOR07=0
replace BEHAVIOR07=1 if vb3!=2501 & vb3!=0
replace BEHAVIOR07=2 if vb2==2 | vb3==0
replace BEHAVIOR07=. if missing(vb2)
replace BEHAVIOR07=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4 | vb20==5
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=q2/10

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR07 FEMALE WHITE AGE URBAN [pweight=wt], base(0)


### AMEs

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR07=2) predict(outcome(2))


###########################################################################
########
#Uruguay
########

### Dependent and Independent Variables

gen CCT=0
replace CCT=1 if cct2a==1|cct2b==1
replace CCT=. if missing(cct1)

gen BEHAVIOR09=0
replace BEHAVIOR09=1 if vb3!=1401 & vb3!=00
replace BEHAVIOR09=2 if vb2==2|vb3==00
replace BEHAVIOR09=. if missing(vb2)
replace BEHAVIOR09=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=0
replace AGE= q2/10
replace AGE=. if missing(q2)

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 1 (Appendix C)
mlogit BEHAVIORNOW CCT##BEHAVIOR09 FEMALE WHITE AGE COLLEGE URBAN RICH, base(0)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR09 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 1 (Appendix C)
margins, dydx(CCT) at(BEHAVIOR09=0) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR09=0) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR09=0) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR09=1) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR09=1) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR09=1) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR09=2) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR09=2) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR09=2) predict(outcome(2))

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR09=2) predict(outcome(2))


###########################################################################
##########
#Venezuela
##########

### Dependent and Independent Variables

gen CCT=0
replace CCT=1 if cct1==1
replace CCT=. if missing(cct1)

gen BEHAVIOR06=0
replace BEHAVIOR06=1 if vb3!=1601 & vb3!=0
replace BEHAVIOR06=2 if vb2==2 | vb3==0
replace BEHAVIOR06=. if missing(vb2)
replace BEHAVIOR06=. if vb2==1&missing(vb3)

gen BEHAVIORNOW=0
replace BEHAVIORNOW=1 if vb20==1 | vb20==4
replace BEHAVIORNOW=2 if vb20==2
replace BEHAVIORNOW=. if missing(vb20)

gen FEMALE=0
replace FEMALE=1 if q1==2
replace FEMALE=. if missing(q1)

gen WHITE=0
replace WHITE=1 if etid==1
replace WHITE=. if missing(etid)

gen AGE=q2/10

gen URBAN=0
replace URBAN=1 if ur==1
replace URBAN=. if missing(ur)

gen RICH=0
replace RICH=1 if q10>6
replace RICH=. if missing(q10)

gen COLLEGE=0
replace COLLEGE=1 if ed>12
replace COLLEGE=. if missing(ed)

gen SKEPTICAL=0
replace SKEPTICAL=1 if n1<4
replace SKEPTICAL=. if missing(n1)

gen LIBERAL=0
replace LIBERAL=1 if ros1==1
replace LIBERAL=. if missing(ros1)

gen INDEX=0
replace INDEX=RICH+COLLEGE+SKEPTICAL+LIBERAL
replace INDEX=. if missing(RICH)|missing(COLLEGE)|missing(SKEPTICAL)|missing(LIBERAL)


### Model Table 1 (Appendix C)
mlogit BEHAVIORNOW CCT##BEHAVIOR06 FEMALE WHITE AGE COLLEGE URBAN RICH, base(0)


### Model Table 4 (Appendix E)
mlogit BEHAVIORNOW c.INDEX##BEHAVIOR06 FEMALE WHITE AGE URBAN, base(0)


### AMEs

# Table 1 (Appendix C)
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(CCT) at(BEHAVIOR06=2) predict(outcome(2))

# Table 4 (Appendix E)
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=0) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=1) predict(outcome(2))

margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(0))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(1))
margins, dydx(INDEX) at(BEHAVIOR06=2) predict(outcome(2))
